#include <iostream>
#include <string>
#include <vector>
#include <climits>

using namespace std;

// https://leetcode.cn/problems/maximum-difference-between-even-and-odd-frequency-i/description/?envType=daily-question&envId=2025-06-10
// 3442. 奇偶频次间的最大差值 I

class Solution {
public:
    int maxDifference(string s) {
        vector<int> countOfChar(26);
        for (int i = 0; i < s.size(); i++){
            int curIndex = s[i] - 'a';
            ++countOfChar[curIndex];
        }
        int maxOdd = 0;
        int minEven = INT_MAX;
        for(auto it : countOfChar){
            if(it != 0){
                if(it % 2 == 0){
                    minEven = min(minEven, it);
                }else{
                    maxOdd = max(maxOdd, it);
                }
            }
        }
        return maxOdd - minEven;
    }
};

int main()
{
    Solution solution{};
    cout << solution.maxDifference("yzyyys") << endl;
    return 0;
}